<!--
 *@Date: 2022-12-06 10:13:22
 * @LastEditTime: 2023-01-31 19:13:34
 *
 * @Description:
-->
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { getSysVersion, wxLogin } from "./utils/net";
import { useUserStore } from '@/stores/modules/user';
import LoginModelImp from '@/pages/login/model/LoginModelImp';
onLaunch(() => {
  console.log("App Launch");
  let sysVision = uni.getStorageSync("sysVision")
  const loginModelImp = new LoginModelImp();
  uni.login({
    provider: 'weixin', //使用微信登录
    success: function (loginRes) {
      if (loginRes.code) {
        loginModelImp.wxLogin(loginRes.code)
      }
    }
  });
  getSysVersion().then((res) => {
    if (res.data.status && res.data.data && res.data.data.mc) {
      if (sysVision !== res.data.data.mc && sysVision) {
        uni.clearStorageSync()
      }
      uni.setStorageSync("sysVision", res.data.data.mc)
    }
  })
});
onShow(() => {
  console.log("App Show");
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">

</style>
